.TH VNSTATI 1 "MAY 2025" "version 2.14" "User Manuals"
.SH NAME
vnstati \- image output support for vnStat

.SH SYNOPSIS

.B vnstati
.RB [ \-5bcdDehiLmosStvy? ]
.RB [ \-\-95th
.IR mode ]
.RB [ \-5g
.RI [ limit ]
.RI [ height ]]
.RB [ \-\-altdate ]
.RB [ \-\-begin
.IR date ]
.RB [ \-\-cache
.IR time ]
.RB [ \-\-config
.IR file ]
.RB [ \-\-days
.RI [ limit ]]
.RB [ \-\-db
.IR file ]
.RB [ \-\-dbdir
.IR directory ]
.RB [ \-\-dbiflist
.RI [ mode ]]
.RB [ \-\-debug ]
.RB [ \-\-end
.IR date ]
.RB [ \-\-fivegraph
.RI [ limit ]
.RI [ height ]]
.RB [ \-\-fiveminutes
.RI [ limit ]]
.RB [ \-\-headertext
.IR text ]
.RB [ \-\-help ]
.RB [ \-hg
.RI [ mode ]]
.RB [ \-\-hours
.RI [ limit ]]
.RB [ \-\-hoursgraph
.RI [ mode ]]
.RB [ \-hs
.RI [ graph ]]
.RB [ \-\-hsummary
.RI [ graph ]]
.RB [ \-i
.IR interface ]
.RB [ \-\-iface
.IR interface ]
.RB [ \-ic
.RI [ mode ]]
.RB [ \-\-invert\-colors
.RI [ mode ]]
.RB [ \-\-large ]
.RB [ \-\-limit
.IR limit ]
.RB [ \-\-locale
.IR locale ]
.RB [ \-\-months
.RI [ limit ]]
.RB [ \-ne ]
.RB [ \-nh ]
.RB [ \-nl ]
.RB [ \-\-noedge ]
.RB [ \-\-noheader ]
.RB [ \-\-nolegend ]
.RB [ \-\-output
.IR file ]
.RB [ \-ru
.RI [ mode ]]
.RB [ \-\-rateunit
.RI [ mode ]]
.RB [ \-\-scale
.IR percent ]
.RB [ \-\-small ]
.RB [ \-\-style
.IR number ]
.RB [ \-\-summary ]
.RB [ \-\-top
.RI [ limit ]]
.RB [ \-\-transparent
.RI [ enabled ]]
.RB [ \-\-version ]
.RB [ \-vs
.RI [ graph ]]
.RB [ \-\-vsummary
.RI [ graph ]]
.RB [ \-\-months
.RI [ limit ]]
.RI [ interface ]

.SH DESCRIPTION

The purpose of
.B vnstati
is to provide image output support for statistics collected using
.BR vnstat (1).
The available image file formats depend on what is supported by the used GD
library. All basic outputs of vnStat are supported excluding live traffic
features. The image can be outputted either to a file or to standard output,
with the later being limited to png image format.

.SH OPTIONS

.TP
.BI "--95th " mode
Show 95th percentile output graph for the ongoing month. This output uses the 5 minute resolution
data of the ongoing month to calculate the 95th percentile traffic rate for received, transmitted
or total as selected using the mandatory
.I mode
parameter. The 95th percentile will be shown as a horizontal line in the graph with the exact 95th
percentile traffic rate visible in the legend section of the image. In addition, a one hour
resolution traffic rate bar graph averaged from the 5 minute resolution data of the selected
.I mode
is presented. This output requires the
.B 5MinuteHours
configuration option to have a value of at least 744 for storing all the necessary data, otherwise 100% coverage
isn't possible. Available modes: 0 = received, 1 = transmitted, 2 = total.

.TP
.B "--altdate"
Use alternative date and time text location. The date and time text will be moved
from the upper right header section to the lower left corner. This option
will have no effect if
.B "-nh, --noheader"
has been selected.

.TP
.BI "-b, --begin " date
Begin the list output with a specific date / time defined by
.I date
instead of the begin being selected based on the number of entries to be shown.
If
.I date
isn't available in the database then the closest later date will be used.
.I date
supports the following formats: YYYY-MM-DD HH:MM, YYYY-MM-DD and "today".
This option can only be used with list outputs.

.TP
.BI "-c, --cache " time
Update output file only if at least
.I time
minutes have passed since the previous file update. This option is ignored if
stdout is used as output.

.TP
.BI "--config " file
Use
.I file
as configuration file instead of using automatic configuration file search
functionality.  If
.B "--config"
is used multiple times, the configuration settings from files later on the command line
will override configuration settings loaded from earlier files if the settings defined
in the files overlap.

.TP
.BI "-d, --days " [limit]
Output traffic statistics on a daily basis for the last days. The length of the list
will be limited to 30 entries unless configured otherwise or unless the optional
.I limit
parameter is used. All entries stored in the database will be shown if
.I limit
is set to 0.

.TP
.BI "--db " file
Use
.I file
as database file instead of searching for a database from the directory specified in
the configuration file or the hardcoded default if no configuration file is available.
This option overrides
.BR "--dbdir" .

.TP
.BI "--dbdir " directory
Use
.I directory
as database directory instead of using the directory specified in the configuration
file or the hardcoded default if no configuration file is available. This option is
ignored if
.B "--db"
is also defined.

.TP
.BI "--dbiflist " [mode]
List interfaces currently in the database. If
.I mode
is not defined or is set to 0 then the output will use a one line verbose format. If
.I mode
is set to 1 then the output will contain one interface per line and if
.I mode
is set to 2 then only the interface count will be shown as a single number. See also
.BR "--iflist" .

.TP
.B "-D, --debug"
Show additional debug output. Can be used multiple times for increased verbosity up to a maximum of 2.

.TP
.BI "-e, --end " date
End the list output with a specific date / time defined by
.I date
instead of the latest date / time in the database. If
.I date
isn't available in the database then the closest earlier date will be used.
.I date
supports the following formats: YYYY-MM-DD HH:MM and YYYY-MM-DD.
This option can only be used with list outputs. The top list also requires
.B "--begin"
to be used at the same time with this option.

.TP
.BI "-5g, --fivegraph " "[limit] [height]"
Output traffic statistics with a 5 minute resolution for the last 48 hours
using a bar graph. The width of the graph can be modified using the optional
.I limit
parameter which represents the number of 5 minute entries with 12 entries for
each hour. The smallest supported value is 288 (last 24 hours). Additionally,
the height of the graph can be modified using the optional
.I height
parameter. The smallest supported height is 150 pixels.

.TP
.BI "-5, --fiveminutes " [limit]
Output traffic statistics with a 5 minute resolution for the last hours.  The length of the list
will be limited to 24 entries unless configured otherwise or unless the optional
.I limit
parameter is used. All entries stored in the database will be shown if
.I limit
is set to 0.

.TP
.BI "--headertext " text
Show
.I text
in image header section instead of automatically generated interface identification.
.I text
is limited to 64 characters and may not get completely shown if longer than the width of
the image. Use with
.B "--altdate"
if maximal space is needed. This option will have no effect if
.B "-nh, --noheader"
has been selected.

.TP
.BI "-h, --hours "  [limit]
Output traffic statistics on a hourly basis. The length of the list will be limited
to 24 entries unless configured otherwise or unless the optional
.I limit
parameter is used. All entries store in the database will be shown if the
.I limit
is set to 0.

.TP
.BI "-hg, --hoursgraph " [mode]
Output traffic statistics on a hourly basis for the last 24 hours using a bar graph.
The optional
.I mode
parameter can be used to override the configuration file setting. Available modes:
0 = 24 hour sliding window, 1 = graph begins from midnight.

.TP
.BI "-hs, --hsummary " [graph]
Output traffic summary with the graph selected using the
.B SummaryGraph
setting in the configuration file next to it using a horizontal layout. The optional
.I graph
parameter can be used to override the configuration file setting. Available graphs:
0 = hours, 1 = 5 minutes.

.TP
.BI "-i, --iface " interface
Use
.I interface
instead of default or configured interface. It is also possible to merge the
information of two or more interfaces using the
.I interface1+interface2+...
syntax. All provided interfaces must be unique and must exist in the database
when the merge syntax is used. Optionally, depending on the
.B InterfaceMatchMethod
configuration setting,
.I interface
can be replaced with
.I alias
previously set using
.BR "vnstat --setalias" .
Merge syntax isn't supported when
.I alias
is used. The
.B "-i, --iface"
option is optional and
.I interface
can be used as parameter on the command line for selecting the used interface
even without the option being explicitly used.

.TP
.BI "-ic, --invert-colors " [mode]
Invert image colors. Results in black becoming white, dark colors becoming light,
light colors becoming dark and white becoming black. The optional
.I mode
parameter can be used to change the color inversion behaviour. Available modes:
0 = no color inversion, 1 = invert all colors except those used for rx and tx,
2 = invert all colors. When
.I mode
isn't specific, mode 1 will be used.

.TP
.B "-L, --large"
Use large fonts in output.

.TP
.BI "--limit " limit
Set the maximum number of shown entries in list outputs to
.IR limit .
Usage of
.B "--limit"
overrides the default list entry limit values and the optional
.I limit
parameter given directly for a list query. All entries stored in the database will be shown if
.I limit
is set to 0.

.TP
.BI "--locale " locale
Use
.I locale
instead of using the locale setting specified in the configuration file or the system
default if no configuration file is available.

.TP
.BI "-m, --months " [limit]
Output traffic statistics on a monthly basis for the last months. The length of the list
will be limited to 12 entries unless configured otherwise or unless the optional
.I limit
parameter is used. All entries stored in the database will be shown if
.I limit
is set to 0.

.TP
.B "-ne, --noedge"
Remove darker edges from around the image.

.TP
.B "-nh, --noheader"
Remove header containing title and update time. Time of the previous update
will still be visible in the lower right corner using a less visible color.

.TP
.B "-nl, --nolegend"
Remove legend containing rx and tx color mapping information from the image.

.TP
.BI "-o, --output " file
Write image to
.I file
and exit. The used image format is selected by the given file extension of
.IR file .
For example, "image.png" results in the file getting written using the png
image format due to the ".png" extension having been used. Usage of png image
format usually results in the smallest file size without loss of detail or
introduction of compression artifacts. Alternatively, output can be directed
to stdout by giving "-" as
.I file
in which case png image format is used.

.TP
.BI "-ru, --rateunit " [mode]
Swap the configured rate unit. If rate has been configured to be shown in
bytes then rate will be shown in bits if this option is present. In the same
way, if rate has been configured to be shown in bits then rate will be shown
in bytes when this option is present. Alternatively,
.I mode
with either 0 or 1 can be used as parameter for this option in order to
select between bytes (0) and bits (1) regardless of the configuration file setting.

.TP
.BI "--scale " percent
Scale output to given
.I percent
resulting in the image being either smaller or larger than the default size.

.TP
.B "-S, --small"
Use small fonts in output.

.TP
.BI "--style " number
Modify the content and style of outputs. Setting
.I number
to 3 will show average traffic rate in all outputs where it is supported.
Other values will show bar graphics instead.

.TP
.B "-s, --summary"
Output traffic statistics summary.

.TP
.BI "-t, --top " [limit]
Output all time top traffic days. The length of the list
will be limited to 10 entries unless configured otherwise or unless the optional
.I limit
parameter is used. All entries stored in the database will be shown if
.I limit
is set to 0. When used with
.B "--begin"
and optionally with
.BR "--end" ,
the list will be generated using the daily data instead of separate top entries.
The availability of daily data defines the boundaries the date specific query
can access.

.TP
.BI "--transparent " [enabled]
Toggle background color transparency depending of the
.B TransparentBg
setting in the configuration file. Alternatively, 0 or 1 can be given as parameter
.I enabled
for this option in order to either disable (0) or enable (1) transparency
regardless of the configuration file setting.

.TP
.B "-v, --version"
Show current version.

.TP
.BI "-vs, --vsummary " [graph]
Output traffic summary with the graph selected using the
.B SummaryGraph
setting in the configuration file below it using a vertical layout. The optional
.I graph
parameter can be used to override the configuration file setting. Available graphs:
0 = hours, 1 = 5 minutes.

.TP
.BI "-y, --years " [limit]
Output traffic statistics on a yearly basis for the last years. The list will show all
entries by default unless configured otherwise or unless the optional
.I limit
parameter is used. All entries stored in the database will also be shown if
.I limit
is set to 0.

.TP
.B "-?, --help"
Show a command option summary.

.SH FILES

.TP
.I /var/lib/vnstat/
Default database directory.

.TP
.I /etc/vnstat.conf
Config file that will be used unless
.I $HOME/.vnstatrc
exists. See
.BR vnstat.conf (5)
for more information.

.SH EXAMPLES

.TP
.B "vnstati -s -i eth0 -o /tmp/vnstat.png"
Output traffic summary for interface eth0 to file /tmp/vnstat.png.

.TP
.B "vnstati -vs -i eth0+eth1+eth2 -o /tmp/vnstat.png"
Output traffic summary with hourly data under the normal summary for a merge of
interfaces eth0, eth1 and eth2 to file /tmp/vnstat.png.

.TP
.B "vnstati -h -c 15 -o /tmp/vnstat_h.png"
Output hourly traffic statistics for default interface to file /tmp/vnstat_h.png
if the file has not been updated within the last 15 minutes.

.TP
.B "vnstati -d -ne -nh -o -"
Output daily traffic statistics without displaying the header section and edges
for default interface to standard output (stdout).

.TP
.B "vnstati -m --config /home/me/vnstat.cfg -i -o -"
Output monthly traffic statistics for default interface specified in configuration
file /home/me/vnstat.cfg to standard output (stdout).

.SH RESTRICTIONS

Depending on the built-in fonts provided by the GD library, not all characters
may end up shown correctly when a UTF-8 locale is used.
.PP
Using long date output formats may cause misalignment in shown columns if the
length of the date exceeds the fixed size allocation.
.PP
Scaling an image when background transparency is enabled may not result in
transparency being retained.

.SH AUTHOR

Teemu Toivola <tst at iki dot fi>

.SH "SEE ALSO"

.BR vnstat (1),
.BR vnstatd (8),
.BR vnstat.conf (5),
.BR units (7)
